package com.javaAPI.demo8;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {

        //键盘录入字符串
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串");
        String str = scanner.nextLine();

        int small = 0;
        int number = 0;
        int big = 0;

        //判断大小写字母及数字
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) <= 'Z' && str.charAt(i) >= 'A') {
                big++;
            } else if (str.charAt(i) <= 'z' && str.charAt(i) >= 'a') {
                small++;
            } else if (str.charAt(i) <= '9' && str.charAt(i) >= '0') {
                number++;
            }
        }
        System.out.println("字符串:" + str);
        System.out.println("大写字符个数:" + big);
        System.out.println("小写字符个数:" + small);
        System.out.println("数字字符个数:" + number);

    }
}
